# Python 2.6.4
# Project Euler, Problem 85
# Copyright 2010 Talha Zaman

def rect(n,m): return n*(n+1)*m*(m+1)/4
target, n, m = 2000000, 1, 2000
minD, minN, minM = target, 0, 0
while(m>n):
    d = abs(rect(n,m)-target)
    if minD>d: minD, minN, minM = d,n,m
    if rect(n,m)>target: m -= 1
    else: n += 1
print minD, ":", minN, "*", minM, "=", minN*minM
